package com.ashbur.rookie.article.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("free")
public class FreemarkerController {

    @Value("${freemarker.html.target}")
    private String htmlTarget;

    @GetMapping("/hello")
    public String hello(Model model) {

        // 定义输出到模板的内容
        // 输入字符串
        String stranger = "菜鸟客栈";
        model.addAttribute("there", stranger);
        // 返回的stu是freemarker模板坐在的目录位置 classpath:/templates/
        // 匹配 *.ftl
        return "stu";
    }

}
